$(document).ready(function () {
    $('body').height($('body')[0].clientHeight);
});
//检查登录 获取缓存
checkLogin();
var worker = getCache('worker');
var info_list = {name: worker.name};
var html = template('header_container', info_list);
document.getElementById('center_header').innerHTML = html;

var checkrepwd = function () {
    var pwd = $('#pwd').val();
    var repwd = $('#repwd').val();
    var status = true;
    if (repwd !== pwd) {
        status = false;
    }
    return {
        status: status, // or false
        message: '新密码与确认密码不一致'
    };
}

//验证表单并处理登录交互
var ajaxOption = {
    url: worker_pwd,
    method: 'POST',
    data: {
        aid: worker.aid,
        sid: worker.sid,
        wid: worker.wid
    },
    success: function (res) {
        setTimeout(function(){
            deleteCache('worker');
            redirect('login.html');
        },2000);
    }
};
checkform($('#MyForm'), ajaxOption)